﻿#region Header
/*
 * name：IServiceFactory
 * author：Kain
 * date：11/29/2010 1:34:56 PM
 *********************************************
 * History:
 * $Header$
 * $History$
 */
#endregion

#region imported namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace Cherry.Agile.Core
{
    /// <summary>
    /// 服务构建工厂接口
    /// </summary>
	public interface IServiceFactory:IDisposable
	{
        /// <summary>
        /// 上下文环境
        /// </summary>
        string Name { get; }
        /// <summary>
        /// 获取一个服务的实例
        /// </summary>
        /// <typeparam name="T">服务类型</typeparam>
        /// <returns></returns>
        T GetService<T>() where T : class;

        /// <summary>
        /// 根据配置中对应的名称获取服务的实例
        /// </summary>
        /// <typeparam name="T">服务类型</typeparam>
        /// <param name="name">服务名称</param>
        /// <returns>服务实例</returns>
        T GetService<T>(string name) where T : class;
	}
}
